/*
 * @Author: PU-TONG 1424838093@qq.com
 * @Date: 2023-06-28 07:40:41
 * @LastEditors: PU-TONG 1424838093@qq.com
 * @LastEditTime: 2023-06-29 01:54:22
 * @FilePath: /openharmony/device/board/isoftstone/qihang/app/My_pro/src/mutex.c
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
#include "mutex.h"
#include <stdio.h>
#include <string.h>
#include <unistd.h>

const static char *TAG = "mutex";

osMutexId_t log_mutexId;
osMutexId_t mq7_mutexId;
osMutexId_t env_mutexId;
osMutexId_t ctrl_mutexId;

/**
 * @brief create_mutex
 *
 */
void create_mutex(void)
{
    log_mutexId = osMutexNew(NULL);
    if (log_mutexId == NULL) {
        printf("[%s][I]Failed to create log Mutex!\n",TAG);
    }
    else{
        printf("[%s][I]Succeed to create log Mutex!\n",TAG);
    }

    mq7_mutexId = osMutexNew(NULL);
    if (mq7_mutexId == NULL) {
        printf("[%s][I]Failed to create mq7 Mutex!\n",TAG);
    }
    else{
        printf("[%s][I]Succeed to create mq7 Mutex!\n",TAG);
    }

    env_mutexId = osMutexNew(NULL);
    if (env_mutexId == NULL) {
        printf("[%s][I]Failed to create env Mutex!\n",TAG);
    }
    else{
        printf("[%s][I]Succeed to create env Mutex!\n",TAG);
    }

    ctrl_mutexId = osMutexNew(NULL);
    if (ctrl_mutexId == NULL) {
        printf("[%s][I]Failed to create ctrl Mutex!\n",TAG);
    }
    else{
        printf("[%s][I]Succeed to create ctrl Mutex!\n",TAG);
    }
}


